import request from '@/utils/request'
// 获取角色列表
export const reqGetRolesList = (page, pagesize) => request({
  method: 'get',
  url: '/sys/role',
  params: {
    page,
    pagesize
  }
})
// 删除角色
export const reqDelRole = (id) => request({
  method: 'delete',
  url: `/sys/role/${id}`
})
export const reqGetCompanyInFo = (id) => request({
  method: 'get',
  url: `/company/${id}`
})
// 获取员工列表
export const reqgetstaffs = (page, size) => request({
  method: 'get',
  url: '/sys/user',
  params: {
    page,
    size
  }
})
// 添加、修改角色
export const reqPostRole = (data) => request({
  method: 'post',
  url: '/sys/role',
  data
})
/** *
 * 修改角色
 * **/
export function reqUpdateRole(data) {
  return request({
    method: 'put',
    url: `/sys/role/${data.id}`,
    data
  })
}

/**
 * 根据 id 获取角色详情, 用于回显
 * **/
export function reqGetRoleDetail(id) {
  return request({
    method: 'get',
    url: `/sys/role/${id}`
  })
}
// 新增员工
export const reqAddEnmployee = (data) => request({
  method: 'post',
  url: '/sys/user',
  data
})
// 批量导入员工
export const reqImportEmployees = (data) => request({
  method: 'post',
  url: '/sys/user/batch',
  data
})
/** *
 * 保存员工的基本信息
 * **/
export function reqSaveUserDetailById(data) {
  return request({
    method: 'put',
    url: `/sys/user/${data.id}`,
    data
  })
}
// 给角色分配权限
export function reqAssignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
